The present disclosure relates to the field of relational databases and, more specifically, to a method and apparatus for optimizing a query statement in a relational database.
Mainstream relational database programs provide relational database services (RDS). An illustrative RDS process parses database query statements (referred herein as “query statements”) and performs query-statement semantic transformation (QST) based on the parsing. In this process, the query statement is also rewritten. The RDS process then performs a selection of access path evaluation based on the query processed by QST and generates access specific language for generating an execution structure by an execution structure generator. The database engine (or the execution module thereof) executes the query based on the execution structure so as to obtain a query result. The process for selecting an optimal access path is an important research subject in the field of database query. Query rewriting is therefore an important part of selecting the optimal access path.